{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3d1f038a-24ba-41be-ba20-aff4fbdebff6",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/partition-list\n",
    "\n",
    "\n",
    "Runtime: 4 ms, faster than 89.51% of C++ online submissions for Partition List.\n",
    "Memory Usage: 10.5 MB, less than 10.77% of C++ online submissions for Partition List.\n",
    "\n",
    "\n",
    "\n",
    "```cpp\n",
    "class Solution {\n",
    "public:\n",
    "    ListNode* partition(ListNode* head, int x) {\n",
    "        //8:51\n",
    "        ListNode* node = head;\n",
    "        vector<int> a;\n",
    "        vector<int> b;\n",
    "        while (node != nullptr) {\n",
    "            if (node->val < x) {\n",
    "                a.push_back(node->val);\n",
    "            } else {\n",
    "                b.push_back(node->val);\n",
    "            }\n",
    "            node = node->next;\n",
    "        }\n",
    "        a.insert(a.end(), b.begin(), b.end());\n",
    "\n",
    "        node = head;\n",
    "        int i = 0;\n",
    "        while (node != nullptr) {\n",
    "            node->val = a[i];\n",
    "            i += 1;\n",
    "            node = node->next;\n",
    "        }\n",
    "\n",
    "        return head;\n",
    "        //8:56\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f3c61fef-67ab-4554-8db5-6674c9289f48",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "name": ""
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
